package com.mindether.llyblog.utils;

import com.github.pagehelper.Page;
import com.mindether.llyblog.pojo.ApiPageResponse;
import com.mindether.llyblog.pojo.Article;

import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.List;

public class Utils {


    public static String getNow(){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        Date date=new Date(System.currentTimeMillis());
        return sdf.format(new Date(System.currentTimeMillis()));
    }

    public static <E> ApiPageResponse<E>  pageUtil(List<E> list, Page<E> ePage){
        ApiPageResponse<E> apiPageResponse=new ApiPageResponse<>();
        apiPageResponse.setRows(list);
        apiPageResponse.setTotal(ePage.getPages());
        apiPageResponse.setSize(ePage.getTotal());
        apiPageResponse.setPageSize(ePage.getPageSize());
        return apiPageResponse;
    }
}
